package com.tf_cut.backend.agent.service;


import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.tf_cut.backend.agent.vo.AgentAndAccountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tf_cut.backend.agent.pojo.AgentSellerRelation;
import com.tf_cut.backend.agent.repository.AgentRepository;
import com.tf_cut.backend.agent.vo.AgentSellerRelationVo;
import com.tf_cut.backend.common.pojo.Result;
import com.tf_cut.backend.common.service.CommonServiceImpl;
import com.tf_cut.backend.mapper.AgentSellerRelationMapper;

@Service
@Transactional
public class AgentSellerRelationServiceImpl extends CommonServiceImpl<AgentSellerRelationVo, AgentSellerRelation, String> implements AgentSellerRelationService {

    @PersistenceContext
    private EntityManager em;
    @Autowired
    private AgentRepository agentSellerRelationRepository;
    
    @Autowired
	private AgentSellerRelationMapper agentSellerRelationMapper;

	@Override
	public Result<List<AgentSellerRelationVo>> findListRelation(AgentSellerRelationVo avo) {
		List<AgentSellerRelationVo> list = agentSellerRelationMapper.findListRelation(avo);
		Result<List<AgentSellerRelationVo>> result = Result.of(list);
		return result;
	}

	@Override
	public List<AgentAndAccountVo> findListAgent(List<String> sellerIds) {
		return agentSellerRelationMapper.findListAgent(sellerIds);
	}
}
